<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./MasterPageHome.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns="http://www.w3.org/1999/xhtml">

    <ui:define name="Title">
        <title>Search</title>
    </ui:define>

    <ui:define name="content">
        <h:form prependId="false">
            <table align="center" cellpadding="15" cellspacing="15">
                <tr>
                    <td width="120px">
                        Home Style:
                    </td>
                    <td>
                        <p:selectOneMenu id="selecthomstyle" value="#{searchMB.homestyle}">
                            <f:selectItem itemLabel="Seller" itemValue="Seller"/>
                            <f:selectItem itemLabel="Leaser" itemValue="Leaser"/>
                        </p:selectOneMenu>
                    </td>
                    <td>
                        
                    </td>
                    <td>
                        
                    </td>
                </tr>
                <tr>
                    <td>
                        Type Of House:
                    </td>
                    <td>
                        <p:selectOneMenu value="#{searchMB.typehouse}" id="txttypehouse">
                            <f:selectItem itemLabel="Home" itemValue="Home"/>
                            <f:selectItem itemLabel="Villa" itemValue="Villa"/>
                            <f:selectItem itemLabel="Apartment" itemValue="Apartment"/>
                            <f:selectItem itemLabel="Commercial Area" itemValue="Commercial Area"/>
                        </p:selectOneMenu>
                    </td>
                    <td>
                        
                    </td>
                    <td>
                        
                    </td>
                </tr>
                <tr>
                    <td>
                        City:
                    </td>
                    <td>
                        <p:inputText id="txtcity" value="#{searchMB.city}" />
                    </td>
                    <td>
                        
                    </td>
                    <td>
                        
                    </td>
                </tr> 
                <tr>
                    <td>
                        Location:
                    </td>
                    <td>
                        <p:inputText id="txtlocation" value="#{searchMB.location}" />
                    </td>
                    <td>
                        
                    </td>
                    <td>
                        
                    </td>
                </tr>
                <tr>
                    <td>
                        From:
                    </td>
                    <td>
                        <p:calendar
                            id="calendarfrom"
                            value="#{searchMB.datefrom}"
                            required="true"
                            pattern="MM/dd/yyyy"
                            yearRange="c-50:c+50"
                            navigator="true"
                            size="22"
                            />
                    </td>
                    <td>
                        -->
                    </td>
                    <td>
                        <p:calendar
                            id="calendarto"
                            value="#{searchMB.dateto}"
                            required="true"
                            pattern="MM/dd/yyyy"
                            yearRange="c-50:c+50"
                            navigator="true"
                            size="22"
                            />
                    </td>
                </tr>
                <tr>
                    <td>
                        Price ($) From:  
                    </td>
                    <td>
                        <p:spinner id="moneyfrom" value="#{searchMB.pricefrom}" prefix="$" min="0" />  
                    </td>
                    <td>
                        -->
                    </td>
                    <td>
                        <p:spinner id="moneyto" value="#{searchMB.priceto}" prefix="$" min="0"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center">
                        <p:commandButton id="cmSearch" action="#{searchMB.search}" ajax="false" value="Search"/>
                    </td>
                </tr>
            </table>
            <p:dataTable id="dataTable" var="house" value="#{searchMB.houseList}"  
                         paginator="true" rows="10"  
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                         rowsPerPageTemplate="5,10,15">  
                <f:facet name="header">  
                    Result  
                </f:facet>  
                <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="Type of House" />  
                    </f:facet>  
                    <h:outputText value="#{house.typehouse}" />  
                </p:column> 
                <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="Home SType" />  
                    </f:facet>  
                    <h:outputText value="#{house.homestyle}" />  
                </p:column> 
                <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="Title House" />  
                    </f:facet>  
                    <h:outputText value="#{house.tittlehouse}" />  
                </p:column>  

                <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="Date Up" />  
                    </f:facet>  
                    <h:outputText value="#{house.dateUp}" >
                        <f:convertDateTime pattern="MM/dd/yyyy"/>
                    </h:outputText>
                </p:column>  

                <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="City" />  
                    </f:facet>  
                    <h:outputText value="#{house.city}" />  
                </p:column>  

                <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="Location" />  
                    </f:facet>  
                    <h:outputText value="#{house.location}" />  
                </p:column>  
                <p:column>  
                    <f:facet name="header">  
                        <h:outputText value="Price" />  
                    </f:facet>  
                    <h:outputText value="#{house.deposit}" >
                        <f:convertNumber pattern="$#,###,##0" />
                    </h:outputText>
                </p:column>
                <p:column>
                    <a href="/DetailsMessage.xhtml?id=#{house.idHouse}">Details</a>
                </p:column>
            </p:dataTable>  
        </h:form>
    </ui:define>

</ui:composition>
